import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2022-12-30
 * Time: 下午 19:31
 */

class Student {

    public int classId;
    public int studentId;
}

@WebServlet("/hello")
public class ShowHttpServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ObjectMapper objectMapper = new ObjectMapper();

        Student student = objectMapper.readValue(req.getInputStream(),Student.class);
        System.out.println(student.classId + "," + student.studentId);
        resp.getWriter().write(student.classId + "," + student.studentId);

    }
}
